﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using YiYiTong.Rocket.EFDBFirst;
using YiYiTong.Rocket.Entity;
using YiYiTong.Rocket.Helper;

namespace YiYiTong.Rocket.Model.ParamModel
{
    /// <summary>
    /// 预热报价订单转为订单
    /// </summary>
    public class OrderPlaceHitOrderModel : BaseParamModel
    {

        public long seq_id { get; set; }
        public long uid { get; set; }

        public decimal place_price { get; set; }
        public string remark { get; set; }
        //cityid
        public long checkaddress { get; set; }

        public NewCreateAddress newCreateAddress { get; set; }

    }

    public class NewCreateAddress
    {
        public string new_receiver { get; set; }
        public string new_receiver_telephone { get; set; }
        public string new_city_id { get; set; }
        public string new_city_name { get; set; }
        public string new_address { get; set; }
        

        public string CheckParam()
        {
            if (new_city_name != null)
                new_city_name = new_city_name.Replace(",", " ");
            StringBuilder strb = new StringBuilder();
            if(string.IsNullOrWhiteSpace(new_receiver))
            {
                strb.Append("收货人姓名必填，");
            }
            if (string.IsNullOrWhiteSpace(new_receiver_telephone))
            {
                strb.Append("收货人手机号必填，");
            }
            else
            {
                if(!Utils.CheckMobile(new_receiver_telephone))
                {
                    strb.Append("手机号格式不正确，");
                }
            }
            if (string.IsNullOrWhiteSpace(new_city_id))
            {
                strb.Append("收货人城市必填，");
            }
            if (string.IsNullOrWhiteSpace(new_address))
            {
                strb.Append("收货人详细地址必填，");
            }
            if(strb.Length > 0)
            {
                strb = strb.Remove(strb.Length - 1, 1);
            }
            return strb.ToString();
        }
    }
}